<template>
  <div>
    <a-button type="link" @click="show">
      设为会员
    </a-button>
    <EditMembership
      ref="EditMembership"
      :memberLevelOption="memberLevelOption"
      @refresh="handleReload"
      :registerId="registerId"
    />
  </div>
</template>
<script>
import EditMembership from '@/components/UserComponents/editMembership.vue'

import { getUserDetail } from '@/api/member/user'
export default {
  components: {
    EditMembership
  },
  props: {
    appUserInfoId: {
      type: Number,
      default: undefined
    },
    registerId: {
      type: Number,
      default: undefined
    },
    memberLevelOption: {
      type: Array,
      default: () => []
    }
  },

  methods: {
    async show() {
      const res = await getUserDetail(this.appUserInfoId)
      this.$refs.EditMembership.show(res.data)
    },

    handleReload() {
      this.$emit('refresh')
    }
  }
}
</script>
